package com.kinyx.framework.db.sentence.res;

import com.kinyx.framework.annotation.assist.Tester;
import com.kinyx.framework.db.configs.DBConfigs;

import lombok.RequiredArgsConstructor;

/**
 * 排序子句
 */
@Tester("com.kinyx.framework.db.sentence.res.Order_Tester_")
@RequiredArgsConstructor
public class Order extends _Sentence {

	/** 列子句 */
	private final Column column;
	/** true: 正序; false: 倒序; */
	private final boolean asc;

	@Override
	public String getSentence(final DBConfigs configs, final boolean isSQL, final boolean withTableAlias) {
		return this.column.getSentence(configs, isSQL, withTableAlias) + " " + (this.asc ? "ASC" : "DESC");
	}

}
